import {defineStore} from 'pinia'

const useStore = defineStore('app', {
    state: () => ({
        token: ''
    }),
    getters: {
        getToken(): string {
            return this.token;
        }
    },
    actions: {
        setToken(token: string) {
            this.token = token;
        }
    },
    persist: {
        key: 'token',
        storage: localStorage,
        pick: ['token']
    }
});

export default useStore;